package com.csun.cmny.provider.device.card.entity;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import lombok.Data;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-12-04 10:11
 * @Description:
 */
@Data
public class CardOpenDoorCmdEntity extends CardCmdEntity {

    /**
     * 分类
     */
    public byte type = 0x03;

    /**
     * 命令
     */
    public byte cmd = 0x03;

    /**
     * 参数
     */
    public byte param = 0x00;

    /**
     * 命令
     */
    public byte[] length = {0x00, 0x00, 0x00, 0x04};

    /**
     * 构造函数 给父类属性赋值
     */
    public CardOpenDoorCmdEntity(String deviceNo, byte[] password, byte[] code, byte[] data) {
        super.type = this.type;
        super.cmd = this.cmd;
        super.param = this.param;
        super.length = this.length;
        super.build(deviceNo, password, code, data);
    }

//    public byte[] getBytes() {
//
//        ByteBuf buf = Unpooled.buffer(34 + this.data.length);
//        buf.writeByte(this.start);
//        buf.writeBytes(this.sn);
//        buf.writeBytes(this.password);
//        buf.writeBytes(this.code);
//        buf.writeByte(this.type);
//        buf.writeByte(this.cmd);
//        buf.writeByte(this.param);
//        buf.writeBytes(this.length);
//        buf.writeBytes(this.data);
//        buf.writeByte(this.check);
//        buf.writeByte(this.end);
//
//        byte[] array = buf.array();
//        this.check = getCheckSum(array, array.length);
//
//        array[array.length - 2] = this.check;
//
//        return array;
//    }



}
